package com.itheima.test;

public class test6 {
    public static void main(String[] args) {
        int[] arr = {1,5,7,3,8,10};
        //调用方法生成最大值
        int max = getMax(arr);
        System.out.println(max);
    }

    //求最大值
    public static int getMax(int[] arr){
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]>max){
                max = arr[i];
            }
        }
        return max;
    }
}
